<template>
  <form>
    <slot></slot>
  </form>
</template>

<script>
export default {
  components:{},
  provide(){
    //把表单实例作为参数传递下去，子代可以直接使用 [inject]
    return {
      form: this,//实例名称为form
    }
  },
  props:{
    model:{
      type:Object,
      required:true
    },
    rules:{
      type:Object
    }
  },
  data(){
    return {
      validatedLen:0,
    }
  },
  watch:{},
  computed:{},
  methods:{
    validate:function(cb){
      let itemChilds = this.$children;
      itemChilds.map(item=>{
        item.validate(item.prop).catch(err=>{
          cb(err)
        })
      })
    },
    updateValidatedLen:function(delta){
      this.validatedLen += delta;
    }
  },
  created(){},
  mounted(){
    
  },
  destroyed(){}
}
</script>
<style lang="scss" scoped>

</style>